<?php
echo "Student list:<br>";
include('Student.php');
$students = array();

// Create and configure students
$first = new Student("Doe", "John");
$first->add_email('home', 'john@doe.com');
$first->add_email('work', 'jdoe@mcdonalds.com');
$first->add_grade(65);
$first->add_grade(75);
$first->add_grade(55);
$first->set_status('Freshman'); // Set status
$students['j123'] = $first;

$second = new Student("Einstein", "Albert");
$second->add_email('home', 'albert@braniacs.com');
$second->add_email('work1', 'a_einstein@bcit.ca');
$second->add_email('work2', 'albert@physics.mit.edu');
$second->add_grade(95);
$second->add_grade(80);
$second->add_grade(50);
$second->set_status('Junior'); // Set status
$students['a456'] = $second;

$third = new Student("Yuhang", "Xie");
$third->add_email('home', 'Xie@Yuhang.com');
$third->add_grade(95); 
$third->add_grade(80); 
$third->add_grade(50); 
$third->set_status('Senior'); // Set status
$students['z789'] = $third;

// Add another student
$fourth = new Student("Nguyen", "Tran");
$fourth->add_email('home', 'tran@nguyen.com');
$fourth->add_grade(85);
$fourth->add_grade(90);
$fourth->set_status('Sophomore'); // Set status
$students['t111'] = $fourth;

ksort($students);

foreach ($students as $student) {
    echo $student->toString();
}
?>